<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Example programs</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../signals2.html" title="Chapter 36. Boost.Signals2">
<link rel="prev" href="tutorial.html" title="Tutorial">
<link rel="next" href="reference.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="tutorial.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../signals2.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="signals2.examples"></a>Example programs</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="examples.html#signals2.examples.misc">Miscellaneous Tutorial Examples</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.document-view">Document-View</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.deconstruct">Postconstructors and Predestructors with <code class="computeroutput">deconstruct()</code></a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="signals2.examples.misc"></a>Miscellaneous Tutorial Examples</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="examples.html#signals2.examples.tutorial.hello_world_slot">hello_world_slot</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.tutorial.hello_world_multi_slot">hello_world_multi_slot</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.tutorial.ordering_slots">ordering_slots</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.tutorial.slot_arguments">slot_arguments</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.tutorial.signal_return_value">signal_return_value</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.tutorial.custom_combiners">custom_combiners</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.tutorial.disconnect_and_block">disconnect_and_block</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.tutorial.passing_slots">passing_slots</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.tutorial.extended_slot">extended_slot</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.tutorial.hello_world_slot"></a>hello_world_slot</h4></div></div></div>
<p>
        This example is a basic example of connecting a slot to a signal
        and then invoking the signal.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/hello_world_slot.cpp" target="_top">hello_world_slot.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.tutorial.hello_world_multi_slot"></a>hello_world_multi_slot</h4></div></div></div>
<p>
        This example extends the hello_world_slot example slightly by connecting more than one
        slot to the signal before invoking it.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/hello_world_multi_slot.cpp" target="_top">hello_world_multi_slot.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.tutorial.ordering_slots"></a>ordering_slots</h4></div></div></div>
<p>
        This example extends the hello_world_multi_slot example slightly by
        using slot groups to specify
        the order slots should be invoked.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/ordering_slots.cpp" target="_top">ordering_slots.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.tutorial.slot_arguments"></a>slot_arguments</h4></div></div></div>
<p>
        The slot_arguments program shows how to pass arguments from a signal invocation to slots.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/slot_arguments.cpp" target="_top">slot_arguments.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.tutorial.signal_return_value"></a>signal_return_value</h4></div></div></div>
<p>
        This example shows how to return a value from slots to the signal invocation.
        It uses the default <code class="computeroutput"><a class="link" href="../boost/signals2/optional_last_value.html" title="Class template optional_last_value">optional_last_value</a></code> combiner.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/signal_return_value.cpp" target="_top">signal_return_value.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.tutorial.custom_combiners"></a>custom_combiners</h4></div></div></div>
<p>
        This example shows more returning of values from slots to the signal invocation.
        This time, custom combiners are defined and used.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/custom_combiners.cpp" target="_top">custom_combiners.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.tutorial.disconnect_and_block"></a>disconnect_and_block</h4></div></div></div>
<p>
        This example demonstrates various means of manually disconnecting slots, as well as temporarily
        blocking them via <code class="computeroutput"><a class="link" href="../boost/signals2/shared_connection_block.html" title="Class shared_connection_block">shared_connection_block</a></code>.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/disconnect_and_block.cpp" target="_top">disconnect_and_block.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.tutorial.passing_slots"></a>passing_slots</h4></div></div></div>
<p>
        This example demonstrates the passing of slot functions to a private signal
        through a non-template interface.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/passing_slots.cpp" target="_top">passing_slots.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.tutorial.extended_slot"></a>extended_slot</h4></div></div></div>
<p>
        This example demonstrates connecting an extended slot to a signal.  An extended slot
        accepts a reference to its invoking signal-slot connection as an additional argument,
        permitting the slot to temporarily block or permanently disconnect itself.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/extended_slot.cpp" target="_top">extended_slot.cpp</a>.
      </p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="signals2.examples.document-view"></a>Document-View</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="examples.html#signals2.examples.document-view.doc_view">doc_view</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.document-view.doc_view_acm">doc_view_acm</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.document-view.doc_view_acm_deconstruct">doc_view_acm_deconstruct</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.document-view.doc_view"></a>doc_view</h4></div></div></div>
<p>
        This is the document-view example program which is described in the
        <a class="link" href="tutorial.html#signals2.tutorial.document-view" title="Example: Document-View">tutorial</a>.  It shows
        usage of a signal and slots to implement two different views of
        a text document.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/doc_view.cpp" target="_top">doc_view.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.document-view.doc_view_acm"></a>doc_view_acm</h4></div></div></div>
<p>
        This program modifies the original doc_view.cpp example to employ
        automatic connection management.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/doc_view_acm.cpp" target="_top">doc_view_acm.cpp</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.document-view.doc_view_acm_deconstruct"></a>doc_view_acm_deconstruct</h4></div></div></div>
<p>
        This program modifies the doc_view_acm.cpp example to use postconstructors
        and the <code class="computeroutput"><a class="link" href="../boost/signals2/deconstruct.html" title="Function deconstruct">deconstruct()</a></code> factory function.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/doc_view_acm_deconstruct.cpp" target="_top">doc_view_acm_deconstruct.cpp</a>.
      </p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="signals2.examples.deconstruct"></a>Postconstructors and Predestructors with <code class="computeroutput">deconstruct()</code>
</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="examples.html#signals2.examples.deconstruct.postconstructor_ex1">postconstructor_ex1</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.deconstruct.postconstructor_ex2">postconstructor_ex2</a></span></dt>
<dt><span class="section"><a href="examples.html#signals2.examples.deconstruct.predestructor_example">predestructor_example</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.deconstruct.postconstructor_ex1"></a>postconstructor_ex1</h4></div></div></div>
<p>
        This program is a basic example of how to define a class with a postconstructor which
        uses <code class="computeroutput"><a class="link" href="../boost/signals2/deconstruct.html" title="Function deconstruct">deconstruct()</a></code> as its factory function.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/postconstructor_ex1.cpp" target="_top">postconstructor_ex1</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.deconstruct.postconstructor_ex2"></a>postconstructor_ex2</h4></div></div></div>
<p>
        This program extends the postconstructor_ex1 example slightly, by additionally passing arguments from
        the <code class="computeroutput"><a class="link" href="../boost/signals2/deconstruct.html" title="Function deconstruct">deconstruct()</a></code> call through to the class' constructor
        and postconstructor.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/postconstructor_ex2.cpp" target="_top">postconstructor_ex2</a>.
      </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="signals2.examples.deconstruct.predestructor_example"></a>predestructor_example</h4></div></div></div>
<p>
        This program is a basic example of how to define a class with a predestructor which
        uses <code class="computeroutput"><a class="link" href="../boost/signals2/deconstruct.html" title="Function deconstruct">deconstruct()</a></code> as its factory function.
      </p>
<p>
        Download <a href="../../../libs/signals2/example/predestructor_example.cpp" target="_top">predestructor_example</a>.
      </p>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: June 12, 2007 at 14:01:23 -0400</small></p></td>
<td align="right"><div class="copyright-footer">Copyright © 2001-2004 Douglas Gregor<br>Copyright © 2007-2009 Frank Mori Hess<p>Distributed under the Boost
    Software License, Version 1.0. (See accompanying file
    <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="tutorial.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../signals2.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
